﻿using NUnit.Framework;
using System.Collections.Generic;
namespace ThunkC_.Collections_
{
    /// <summary>
    /// ICollectionFixture
    /// </summary>
    [TestFixture]
    public class ICollectionFixture
    {
        [Test]
        public void Add_TwoElementList_CountEqualsThree()
        {
            var collection = (ICollection<int>)new List<int>(new int[] { 0, 1 });
            collection.Add(2);
            Assert.AreEqual(3, collection.Count);
        }

        [Test]
        public void Clear_TwoElementList_CountEqualsZero()
        {
            var collection = (ICollection<int>)new List<int>(new int[] { 0, 1 });
            collection.Clear();
            Assert.AreEqual(0, collection.Count);
        }

        [Test]
        public void Contains_TwoElementList_EqualsTrue()
        {
            var collection = (ICollection<int>)new List<int>(new int[] { 0, 1 });
            Assert.IsTrue(collection.Contains(1));
        }

        [Test]
        public void CopyTo_TwoElementList_CountEqualsTrue()
        {
            var collection = (ICollection<int>)new List<int>(new int[] { 0, 1 });
            int[] array = new int[2];
            collection.CopyTo(array, 0);
            Assert.AreEqual(2, collection.Count);
        }

        [Test]
        public void Remove_TwoElementList_CountEqualsOne()
        {
            var collection = (ICollection<int>)new List<int>(new int[] { 0, 1 });
            collection.Remove(1);
            Assert.AreEqual(1, collection.Count);
        }

        [Test]
        public void getCount_TwoElementList_EqualsTwo()
        {
            var collection = (ICollection<int>)new List<int>(new int[] { 0, 1 });
            Assert.AreEqual(2, collection.Count);
        }

        [Test]
        public void getReadOnly_TwoElementList_EqualsFalse()
        {
            var collection = (ICollection<int>)new List<int>(new int[] { 0, 1 });
            Assert.IsFalse(collection.IsReadOnly);
        }
    }
}
